package com.ming.springcloud.consumer.service;

import com.ming.springcloud.consumer.hystric.BookServiceHystric;
import com.ming.springcloud.consumer.vo.Books;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "student-service-provider", fallback = BookServiceHystric.class)  //服务提供者的名字
public interface BookService {

    @RequestMapping(value = "/book/findAllBooks", method = RequestMethod.GET)
    String findAllBooks(@RequestParam(value = "name") String name);

    @RequestMapping(value = "/book/findBooksById/{id}", method = RequestMethod.GET)
    String findBooksById(@RequestParam(value = "name") String name,@RequestParam(value = "id") Integer id);

    @RequestMapping(value = "/book/delBook/{id}", method = RequestMethod.GET)
    String delBook(@RequestParam(value = "name") String name,@RequestParam(value = "id") Integer id);

    @RequestMapping(value = "/book/editBook", method = RequestMethod.POST)
    String editBook(@RequestParam(value = "name") String name, @RequestBody Books book);

    @RequestMapping(value = "/book/addBook", method = RequestMethod.POST)
    String addBook(@RequestParam(value = "name") String name, @RequestBody Books book);
}
